#include "Input.h"
#include "Constants.h"
#include <SDL/SDL.h>
#include <iostream>
using namespace std;

Input::Input()
{
	for (int i=0; i<321; i++)
	{
		key[i] = false;
	}
}

void Input::addInputListener(InputListener * inputListener)
{
	inputListeners.push_back(inputListener);
}

Input::~Input()
{
}

void Input::handleInput(float timeD)
{
	for(int i=0; (unsigned)i < inputListeners.size(); i++)
	{
		inputListeners[i]->handleInput(key, timeD);
	}
	
	if(key[SDLK_ESCAPE])
	{
		cout << "Escape hit, quitting";
		throw "bail";
	}
}
